<?php

require_once 'conectar.php';
require_once 'conectar2.php';

class servicio {

    private $idservicio;
    private $idtipopago;
    private $nombre;
    private $monto;

    public function __construct($idservicio, $idtipopago, $nombre, $monto) {
        $this->idservicio = $idservicio;
        $this->idtipopago = $idtipopago;
        $this->nombre = $nombre;
        $this->monto = $monto;
    }

    public function guardar() {
        $sql = "SELECT abm_servicios(1," . $this->idservicio . ","  . $this->idtipopago . "," . "'".$this->nombre."'" . "," . $this->monto . ");";


        pg_query(conectar::conecta(), $sql);
    }

    public function Buscar() {


        $conexion = new conectar2;
        $consulta = $conexion->query("select * from servicios");

        $this->nombre = $consulta[1];
        $this->idubicacion = $consulta[2];
        return $consulta;
    }

}

?>